Skip to content

test(e2e): add Tier 1 plan — copy file / relative path#1032

Merged
wenytang-ms merged 1 commit into
mainfrom
e2e/copy-paths
Jun 10, 2026
Merged

test(e2e): add Tier 1 plan — copy file / relative path#1032
wenytang-ms merged 1 commit into
mainfrom
e2e/copy-paths

Conversation

@wenytang-ms

Copy link
Copy Markdown
Contributor

Summary

Adds an E2E plan covering the two clipboard commands contributed against the Java Projects view:

  • java.view.package.copyFilePath (Copy Path)
  • java.view.package.copyRelativeFilePath (Copy Relative Path)

Both handlers (dependencyExplorer.ts:159 and :165) are thin wrappers that forward the selected DataNode's URI to VS Code's built-in copyFilePath / copyRelativeFilePath. They have no on-screen side effect whatsoever — the only observable consequence is what lands on the OS clipboard. Verifying them therefore requires the new clipboard primitives (writeClipboard / verifyClipboard) added in autotest 0.7.16 (wenytang-ms/javaext-autotest#6).

Plan shape

  • Setup: wait for LS, free sidebar space, collapse workspace root, focus Java Projects.
  • Reveal App.java via Quick Open (link-with-editor auto-expands the tree path), then click the tree row with the new exact modifier to disambiguate the leaf label App from the project node my-app (which would otherwise be matched first by case-insensitive substring and silently selected, producing the workspace folder URI instead of the file URI).
  • For each command: seed the clipboard with a sentinel, invoke the command by id, assert the clipboard contains App.java, matches the expected path-suffix shape (cross-OS regex tolerating both \ and / separators), and no longer equals the sentinel.

Cross-OS note

VS Code's built-in copyRelativeFilePath computes path.relative(workspaceFolderUri, fileUri) and falls back to the absolute path when membership fails. On Windows the URI we pass (Uri.parse(cmdNode.uri) from JDT.LS) can differ in drive-letter case or percent-encoding from VS Code's registered workspace folder URI, so the membership test fails and the absolute path comes back. On POSIX the URIs match and the relative form is produced. The assertions tolerate both — they prove the command fired and overwrote the sentinel with a well-formed path ending in the expected layout, but do not require the leading-src shape that only POSIX produces.

Coverage

Moves from ~33 → ~35 of the ~39 user-facing Java Manager commands. Tier 2 (file-menu / file-explorer wrappers) and Tier 3 (gradle lifecycle, multi-module navigation) remain deferred.

Test plan

Full local e2e suite on Windows: 12/12 plans pass (325 steps total) including the new java-dep-copy-paths.yaml at 17/17.

Dependency

CI installs autotest globally via npm install -g @vscjava/vscode-autotest (unpinned). Requires autotest ≥ 0.7.16 on the npm registry — gated on wenytang-ms/javaext-autotest#6 being merged + published.

Adds an E2E plan covering the two clipboard commands contributed against
the Java Projects view:

  - java.view.package.copyFilePath          (Copy Path)
  - java.view.package.copyRelativeFilePath  (Copy Relative Path)

Both handlers (dependencyExplorer.ts:159 and :165) are thin wrappers
that forward the selected DataNode's URI to VS Code's built-in
copyFilePath / copyRelativeFilePath. They have no on-screen side effect
whatsoever — the only observable consequence is what lands on the OS
clipboard. Verifying them therefore requires the new clipboard
primitives (writeClipboard / verifyClipboard) added in autotest 0.7.16.

Plan shape
- Setup: wait for LS, free sidebar space, collapse workspace root, focus
  Java Projects.
- Reveal App.java via Quick Open (link-with-editor auto-expands the
  tree path), then click the tree row with the new `exact` modifier
  to disambiguate the leaf label "App" from the project node "my-app"
  (which would otherwise be matched first by case-insensitive substring
  and silently selected, producing the workspace folder URI instead of
  the file URI).
- For each command: seed the clipboard with a sentinel, invoke the
  command by id, assert the clipboard contains "App.java", matches the
  expected path-suffix shape (cross-OS regex tolerating both
  `\` and `/` separators), and no longer equals the sentinel.

Cross-OS note
- VS Code's built-in `copyRelativeFilePath` computes
  `path.relative(workspaceFolderUri, fileUri)` and falls back to the
  absolute path when membership fails. On Windows the URI we pass
  (`Uri.parse(cmdNode.uri)` from JDT.LS) can differ in drive-letter
  case or percent-encoding from VS Code's registered workspace folder
  URI, so the membership test fails and the absolute path comes back.
  On POSIX the URIs match and the relative form is produced. The
  assertions tolerate both — they prove the command fired and overwrote
  the sentinel with a well-formed path ending in the expected layout,
  but do not require the leading-`src` shape that only POSIX produces.

Coverage moves from ~33 → 35 of the ~39 user-facing Java Manager
commands. Tier 2 (file-menu / file-explorer wrappers) and Tier 3
(gradle lifecycle, multi-module navigation) remain deferred.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new E2E plan to validate the Java Projects view clipboard wrapper commands (java.view.package.copyFilePath and java.view.package.copyRelativeFilePath) by asserting OS clipboard contents (seed sentinel → invoke command → verify clipboard text and path shape across OSes).

Changes:

  • Added a new E2E plan that selects App in the Java Projects tree deterministically and invokes both copy-path commands by id.
  • Verifies clipboard output using sentinel overwrite checks plus cross-OS regex matching for expected path suffixes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/e2e-plans/java-dep-copy-paths.yaml
@wenytang-ms wenytang-ms merged commit 0dc2467 into main Jun 10, 2026
59 of 63 checks passed
@wenytang-ms wenytang-ms deleted the e2e/copy-paths branch June 10, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants